package net.hn.hnms.biz.common.activiti.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import net.hn.hnms.biz.common.activiti.builder.ProcessDefinitionExecutor;
import net.hn.hnms.biz.common.activiti.builder.ProcessExecutor;
import net.hn.hnms.biz.common.activiti.builder.TaskExecutor;
import net.hn.hnms.biz.common.activiti.service.ProcessApiService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created on 2022/8/5.
 *
 * @author ly
 * @desc: activiti 流程服务
 */
@Service
@DS("activiti")
public class ProcessService {

    @Resource
    private ProcessApiService processApiService;

    /**
     * 创建流程任务相关处理器
     * @return 流程任务相关处理器
     */
    public TaskExecutor taskExecutor() {
        return new TaskExecutor(processApiService);
    }

    /**
     * 创建流程相关处理器
     * @return 流程相关处理器
     */
    public ProcessExecutor processExecutor() {
        return new ProcessExecutor(processApiService);
    }


    /**
     * 创建流程定义相关处理器
     * @return 流程定义相关处理器
     */
    public ProcessDefinitionExecutor processDefinitionExecutor() {
        return new ProcessDefinitionExecutor(processApiService);
    }
}
